Exponer como Herramienta CLI y soporte para Docker#12
Open
dreglad wants to merge 10 commits intophpcfdi:mainfrom
Open
Exponer como Herramienta CLI y soporte para Docker#12dreglad wants to merge 10 commits intophpcfdi:mainfrom
dreglad wants to merge 10 commits intophpcfdi:mainfrom
Conversation
Author
|
Para hacer una prueba rápida con la imagen en mi Docker Hub personal, usando un PDF de un CSF descargable público: docker run --rm \
dreglad/csf-scraper \
obtain https://siafweb.ib.unam.mx/CSF.pdf{
"razon_social": "UNIVERSIDAD NACIONAL AUTONOMA DE MEXICO",
"regimen_de_capital": "SIN TIPO DE SOCIEDAD",
"fecha_constitucion": {
"date": "1929-07-22 00:00:00.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"rfc": "UNA2907227Y5",
// ...,
// etcétera
}Combinado con Imprime solo el RFC docker run --rm \
dreglad/csf-scraper \
obtain https://siafweb.ib.unam.mx/CSF.pdf | jq -r .rfc
UNA2907227Y5Lista de ID y descripción de cada regimen: $ cat ~/csf.pdf \
| docker run --rm -i dreglad/csf-scraper obtain - \
| jq -r '.regimenes[] | "\(.regimen_id) - \(.regimen)"'
605 - Régimen de Sueldos y Salarios e Ingresos Asimilados a Salarios
612 - Régimen de las Personas Físicas con Actividades Empresariales y Profesionales |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Este PR introduce la capacidad de usar como herramienta de línea de comandos (CLI) y soporte oficial para Docker.
Estas adiciones facilitan el uso de la herramienta como un proceso independiente auto-ejecutable y no solo como una librería de PHP.
Cambios Propuestos
Script Ejecutable CLI en
bin/csf-scraperque permite obtener datos de una Constancia de Situación Fiscal (CSF) directamente desde la terminal a partir de un archivo PDF local/descargable o de una combinación de idCIF y RFC.JSON Schema en
docs/schemas/csf.schema.json. Descripción formal de la estructura del JSON esperado, útil para documentación y para validación dinámica de la salida. La herramienta CLI muestra este schema con el comandoschema.Infraestructura Docker. Se añade
Dockerfiley workflow CI/CD para hacer build y push a registry, inspirado en el repositorio: https://github.com/phpcfdi/cfditopdfDocumentación. Se añadió la sección "Uso con Docker" en
README.mdcon ejemplos prácticos.Tests. Se actualizaron tests unitarios y se añadió un test de integración de la interfaz de la herramienta CLI
Otros ajustes menores
timeoutpredeterminado a las consultas HTTP al SAT, ya que anteriormente el proceso potencialmente podía colgadarse por tiempo indeterminado.-nopgbrkapdftotextpara compatibilidad con Poppler (corrige falla en versiones recientes de Poppler, sin alterar comportamiento en versiones anteriores)Invocación
$ bin/csf-scrapper help